var path = require('path') 
var htmlWebpackPlugin = require('html-webpack-plugin')
var VueLoaderPlugin = require('vue-loader/lib/plugin')

module.exports = {
    entry: path.join(__dirname,'./src/main.js'),
    output:{
        path: path.join(__dirname,'./dist'),
        filename: 'bundle.js'
    },
    plugins:[
        new htmlWebpackPlugin({
            template:path.join(__dirname,'./src/index.html'),
            filename:'index.html',
            // favicon: path.resolve('./images/favicon.png') // 增加
        }),
        new VueLoaderPlugin()
    ],
    module:{//配置所有第三方loader模块
        rules:[
            {test:/\.css$/,use:['style-loader','css-loader']},
            {test:/\.js$/,use:'babel-loader',exclude:/node_modules/},
            // 第三方loader
            {test:/\.less$/,use:['style-loader','css-loader','less-loader']},
            {test:/\.scss$/,use:['style-loader','css-loader','sass-loader']},
            {test:/\.(jpg|png|gif|bmp|jpeg|ico)$/,use:{loader:'url-loader',options:{esModule: false,name:'[name].[ext]',outputPath:'images/',limit:2048}}},
            {test:/\.(ttf|eot|svg|woff|woff2|otf)$/,use:'url-loader'},
            {test:/\.vue$/,use:'vue-loader'},
            {test:/\.json$/,use:'json-loader'},
            {test:/\.html$/,use:{loader:'html-loader',options:{esModule: false,name:'[name].[ext]',outputPath:'images/',limit:2048}}}
        ]
    },
    resolve:{
        alias:{//修改vue被导入时候的包的路径
            // "vue$":"vue/dist/vue.js"
        }
    }
}